package neuralmusic.midiIO;


public class Hammer {
	
	float tConstant;
	float damp;
	float stiff;
	
	float state;
	float vel;
	private double lastUpdateTime;
	
	
	void excite(float val) {
		
		updateState();
		
		vel += val;
		state += vel;
		
		
	}
	
	 // apply any pending decay due to time lasped to the state.
    public void updateState() {
        double now = 0;// FIXME TimeRef.getCurrentTimeInSecs();
        state = (float) (state * Math.exp(-tConstant * (now - lastUpdateTime)));
        vel = (float) (vel * Math.exp(-tConstant * (now - lastUpdateTime)));
        lastUpdateTime = now;
    }
	
}
